package ronglei.day01.demo07String;
/*
* 自定义一个数组 把数组{1,2,3}制定格式拼成一个字符串格式为 [word1#word2#word3]
* */
public class String07 {
    public static void main(String[] args) {
        int[] array =  {1,2,3};
        String str2 = formArrayToString(array);
        System.out.println(str2);
    }
    public  static  String formArrayToString(int[] array){
        String str1 ="[";
        for (int i = 0; i < array.length; i++) {
            if(array.length-1==i){
                str1+="word"+array[i]+"]";
            }else{
                str1+="word"+array[i]+"#";

            }
        }
        return str1;
    }
}
